package com.warm.spring.ioc.expand;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

/**
 * @Description 添加初始化 bean 操作
 * @Author iyb-liangchuang
 * @Date 2021/6/3 9:35
 */
@Component
public class InsInitAndDestroyBean implements InitializingBean, DisposableBean {

    @Override
    public void afterPropertiesSet() throws Exception {
        // do init
        // replace by @PostConstruct
        System.out.println(">>>>> InsInitAndDestroyBean init...");
    }

    @Override
    public void destroy() throws Exception {
        // do destroy
        // replace by @PreDestroy
        System.out.println(">>>>> InsInitAndDestroyBean destroy...");
    }
}
